<?php
namespace core\lib\drive\log;

class file{
	//日志存储位置
	public $path;

	public function __construct(){
		$conf = \core\lib\conf::get('OPTION','log');
		// p($conf);
		$this->path = $conf['PATH'];
		p($this->path);
	}

	public function log($message,$file = 'log'){
		// p($name);
		if(!is_dir($this->path)){
			mkdir($this->path,'0777',true);
		}
		$message = date('Y-m-d H:i:s').': '.json_encode($message);
		return file_put_contents($this->path.'/'.$file.'.php', $message.PHP_EOL,FILE_APPEND);
	}
}